package com.jz.config;

import com.jz.util.ResultUtil;
import com.jz.util.SysCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @author liangliang
 * @version 1.0
 * @date 2019/5/28 11:17
 * @description GlobalExceptionHandler 全局异常处理
 **/
@ControllerAdvice
public class GlobalExceptionHandlerConfig {

    /**
     * 捕获全局异常
     *
     * @param e 异常信息
     * @return 返回统一格式
     */
    @ExceptionHandler(Exception.class)
    public ResultUtil exceptionHandler(Exception e) {
        e.printStackTrace();
        return ResultUtil.error(SysCode.SERVER_BUSY);
    }

}
